<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<title>Add Labor type</title>
<script src="js/1.7.1jquery.min.js"></script>

<link rel="stylesheet" href="css/jquery.ui.base.css" />
<link rel="stylesheet" href="css/jquery.ui.theme.css" />
<script src="js/jquery-1.9.0.js"></script>
<script src="js/jquery.ui.core.js"></script>
<script src="js/jquery.ui.widget.js"></script>
<script src="js/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="css/demos.css" />
<script>
	$(function() {
		$(".datepicker").datepicker({
			altField : "#alternate",
			altFormat : "DD, d MM, yy"
		});
	});
</script>


<script src="js/jquery.tabSlideOut.v1.3.js"></script>
<script type="text/javascript">
	$(function() {
		$('.slide-out-div').tabSlideOut({
			tabHandle : '.handle', //class of the element that will become your tab
			pathToTabImage : 'images/takeatestdrive.png', //path to the image for the tab //Optionally can be set using css
			imageHeight : '187px', //height of tab image           //Optionally can be set using css
			imageWidth : '31px', //width of tab image            //Optionally can be set using css
			tabLocation : 'right', //side of screen where tab lives, top, right, bottom, or left
			speed : 300, //speed of animation
			action : 'click', //options: 'click' or 'hover', action to trigger animation
			topPos : '400px', //position from the top/ use if tabLocation is left or right
			rightPos : '20px', //position from left/ use if tabLocation is bottom or top
			fixedPosition : true
		//options: true makes it stick(fixed position) on scroll

		});

	});
</script>
<script type="text/javascript" language="javascript">
	$(document).ready(
			function() {
				$('.adCntnr div.acco2:eq(0)').find('div.expand:eq(0)')
						.addClass('openAd').end().find('div.collapse:gt(0)')
						.hide().end().find('div.expand').click(
								function() {
									$(this).toggleClass('openAd').siblings()
											.removeClass('openAd').end().next(
													'div.collapse')
											.slideToggle().siblings(
													'div.collapse:visible')
											.slideUp();
									return false;
								});
			})
</script>


<script>
function deleteLaborType(val) {
		//	alert("selectProject called");
		//alert("val="+val);
		document.getElementById("laborTypeId").value = val;
		document.getElementById("action").value = "delete";
		//alert("selectProject end");
		document.getElementById("laborTypeForm").submit();
	}
</script>
</head>

<body>

	<%-- <%@ include file="/include/sessionCheck.jsp"%> --%>

	<%@ include file="/include/header.jsp"%>

	<%@ include file="/include/menu.jsp"%>

	<!--right start-->
	<div class="right_div">
		<span class="head_font">Add Labor Type</span>
		<div class="height20"></div>
		<html:errors />
		<%-- <html:javascript formName="laborTypeForm" /> --%>
		<jsp:include page="/customError.jsp" />
		<html:form action="laborType.do" method="post">
			<input type="hidden" name="action" value="add" />
			<div class="grey_box">
				<table border="0" cellspacing="0" cellpadding="5" width="95%">
					<tr>
						<td width="15%">Labor Type</td>
						<td width="25%"><html:text property="laborType"
								styleClass="input_text"></html:text>
						</td>
						<td width="35%">&nbsp;</td>
					</tr>
					<tr>
						<td width="15%"></td>
						<td width="25%"><html:submit value="Save" styleClass="btn"></html:submit>
						</td>
						<td width="35%">&nbsp;</td>
					</tr>
				</table>
			</div>
		</html:form>

		<form id="laborTypeForm" action="laborType.do" method="post">
			<input type="hidden" name="action" id="action" /> <input
				type="hidden" name="laborTypeId" id="laborTypeId" />
		</form>

		<logic:present name="laborTypes" scope="session">
			<br />
			<span class="head_font">Labor Type List</span>
			<div class="height20"></div>
			<div>
				<table border="0" cellspacing="0" cellpadding="5" width="95%"
					class="grid">
					<tr>
						<th><input type="checkbox" /></th>
						<th>Labor Type id</th>
						<th>Labor Type</th>
						<th>Actions</th>
					</tr>
					<logic:iterate id="element" name="laborTypes" scope="session">
						<tr>
							<td><input type="checkbox" /></td>
							<td><bean:write name="element" property="laborTypeId" /></td>
							<td><bean:write name="element" property="laborType" />
							</td>
							<td class="see_det_font"><logic:present name="currentUser"
									scope="session">
									<logic:equal name="currentUser" property="userType"
										value="admin">
										<a href='#'
											onclick='deleteLaborType(<bean:write name="element"
											property="laborTypeId" />)'>
											Delete</a>
									</logic:equal>
								</logic:present></td>
						</tr>

					</logic:iterate>

				</table>

			</div>

		</logic:present>

	</div>
	<!--right end-->

	<div class="clear"></div>

	<%@ include file="/include/footer.jsp"%>

</body>
</html>
